package puzzle.common.solver;

import java.util.Comparator;
import java.util.List;

public class TrackTopology extends AbstractTopology {
	private List<Track> m_tracks;
	private int m_totalLeg;

	public TrackTopology(List<Track> tracks) {
		m_tracks = tracks;

		for (Track track : tracks) {
			m_totalLeg += track.getLeg();
		}
	}

	public List<Track> getTracks() {
		return m_tracks;
	}

	public int getTotalLeg() {
		return m_totalLeg;
	}

	public static final Comparator<BoardSnapshot<?, ? extends TrackTopology, ?>> TOTAL_LEG_BOARD_COMPARATOR = new Comparator<BoardSnapshot<?, ? extends TrackTopology, ?>>() {
		public int compare(BoardSnapshot<?, ? extends TrackTopology, ?> o1,
				BoardSnapshot<?, ? extends TrackTopology, ?> o2) {
			return o2.getTopology().getTotalLeg() - o1.getTopology().getTotalLeg();
		}
	};

}
